package com.tencent.cloud.iov.action;

/**
 * 行为管理类
 *
 * @author showxiao
 * @date 2018/4/19
 */

public class ActionManager {

    private static IActionHandler sActionHandler;

    public static void initActionHandler(IActionHandler actionHandler) {
        sActionHandler = actionHandler;
    }

    public static boolean handleAction(Object target, String actionId, Object... args) {
        if (sActionHandler != null) {
            return sActionHandler.handleAction(target, actionId, args);
        }

        throw new IllegalStateException("ActionHandler has not be setup by " +
                "ActionManager.initActionHandler()");
    }

}
